home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 November / Freeware November 1998.img / dist / fw_elisp-manual-19.idb / usr / freeware / info / elisp-33.z / elisp-33 (.txt)
GNU Info File  |  1998-05-26  |  49KB  |  910 lines

  1. This is Info file elisp, produced by Makeinfo-1.63 from the input file
  2. elisp.texi.
  3.    This version is the edition 2.4.2 of the GNU Emacs Lisp Reference
  4. Manual.  It corresponds to Emacs Version 19.34.
  5.    Published by the Free Software Foundation 59 Temple Place, Suite 330
  6. Boston, MA  02111-1307  USA
  7.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996 Free Software
  8. Foundation, Inc.
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.    Permission is granted to copy and distribute modified versions of
  13. this manual under the conditions for verbatim copying, provided that the
  14. entire resulting derived work is distributed under the terms of a
  15. permission notice identical to this one.
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that this permission notice may be stated in a
  19. translation approved by the Foundation.
  20.    Permission is granted to copy and distribute modified versions of
  21. this manual under the conditions for verbatim copying, provided also
  22. that the section entitled "GNU General Public License" is included
  23. exactly as in the original, and provided that the entire resulting
  24. derived work is distributed under the terms of a permission notice
  25. identical to this one.
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that the section entitled "GNU General Public License"
  29. may be included in a translation approved by the Free Software
  30. Foundation instead of in the original English.
  31. File: elisp,  Node: Temporary Displays,  Next: Overlays,  Prev: Overlay Arrow,  Up: Display
  32. Temporary Displays
  33. ==================
  34.    Temporary displays are used by commands to put output into a buffer
  35. and then present it to the user for perusal rather than for editing.
  36. Many of the help commands use this feature.
  37.  - Special Form: with-output-to-temp-buffer BUFFER-NAME FORMS...
  38.      This function executes FORMS while arranging to insert any output
  39.      they print into the buffer named BUFFER-NAME.  The buffer is then
  40.      shown in some window for viewing, displayed but not selected.
  41.      The string BUFFER-NAME specifies the temporary buffer, which need
  42.      not already exist.  The argument must be a string, not a buffer.
  43.      The buffer is erased initially (with no questions asked), and it is
  44.      marked as unmodified after `with-output-to-temp-buffer' exits.
  45.      `with-output-to-temp-buffer' binds `standard-output' to the
  46.      temporary buffer, then it evaluates the forms in FORMS.  Output
  47.      using the Lisp output functions within FORMS goes by default to
  48.      that buffer (but screen display and messages in the echo area,
  49.      although they are "output" in the general sense of the word, are
  50.      not affected).  *Note Output Functions::.
  51.      The value of the last form in FORMS is returned.
  52.           ---------- Buffer: foo ----------
  53.            This is the contents of foo.
  54.           ---------- Buffer: foo ----------
  55.           
  56.           (with-output-to-temp-buffer "foo"
  57.               (print 20)
  58.               (print standard-output))
  59.           => #<buffer foo>
  60.           
  61.           ---------- Buffer: foo ----------
  62.           20
  63.           
  64.           #<buffer foo>
  65.           
  66.           ---------- Buffer: foo ----------
  67.  - Variable: temp-buffer-show-function
  68.      If this variable is non-`nil', `with-output-to-temp-buffer' calls
  69.      it as a function to do the job of displaying a help buffer.  The
  70.      function gets one argument, which is the buffer it should display.
  71.      In Emacs versions 18 and earlier, this variable was called
  72.      `temp-buffer-show-hook'.
  73.  - Function: momentary-string-display STRING POSITION &optional CHAR
  74.           MESSAGE
  75.      This function momentarily displays STRING in the current buffer at
  76.      POSITION.  It has no effect on the undo list or on the buffer's
  77.      modification status.
  78.      The momentary display remains until the next input event.  If the
  79.      next input event is CHAR, `momentary-string-display' ignores it
  80.      and returns.  Otherwise, that event remains buffered for
  81.      subsequent use as input.  Thus, typing CHAR will simply remove the
  82.      string from the display, while typing (say) `C-f' will remove the
  83.      string from the display and later (presumably) move point forward.
  84.      The argument CHAR is a space by default.
  85.      The return value of `momentary-string-display' is not meaningful.
  86.      If the string STRING does not contain control characters, you can
  87.      do the same job in a more general way by creating an overlay with a
  88.      `before-string' property.  *Note Overlay Properties::.
  89.      If MESSAGE is non-`nil', it is displayed in the echo area while
  90.      STRING is displayed in the buffer.  If it is `nil', a default
  91.      message says to type CHAR to continue.
  92.      In this example, point is initially located at the beginning of the
  93.      second line:
  94.           ---------- Buffer: foo ----------
  95.           This is the contents of foo.
  96.           -!-Second line.
  97.           ---------- Buffer: foo ----------
  98.           
  99.           (momentary-string-display
  100.             "**** Important Message! ****"
  101.             (point) ?\r
  102.             "Type RET when done reading")
  103.           => t
  104.           
  105.           ---------- Buffer: foo ----------
  106.           This is the contents of foo.
  107.           **** Important Message! ****Second line.
  108.           ---------- Buffer: foo ----------
  109.           
  110.           ---------- Echo Area ----------
  111.           Type RET when done reading
  112.           ---------- Echo Area ----------
  113. File: elisp,  Node: Overlays,  Next: Faces,  Prev: Temporary Displays,  Up: Display
  114. Overlays
  115. ========
  116.    You can use "overlays" to alter the appearance of a buffer's text on
  117. the screen, for the sake of presentation features.  An overlay is an
  118. object that belongs to a particular buffer, and has a specified
  119. beginning and end.  It also has properties that you can examine and set;
  120. these affect the display of the text within the overlay.
  121. * Menu:
  122. * Overlay Properties::    How to read and set properties.
  123.             What properties do to the screen display.
  124. * Managing Overlays::   Creating, moving, finding overlays.
  125. File: elisp,  Node: Overlay Properties,  Next: Managing Overlays,  Up: Overlays
  126. Overlay Properties
  127. ------------------
  128.    Overlay properties are like text properties in some respects, but the
  129. differences are more important than the similarities.  Text properties
  130. are considered a part of the text; overlays are specifically considered
  131. not to be part of the text.  Thus, copying text between various buffers
  132. and strings preserves text properties, but does not try to preserve
  133. overlays.  Changing a buffer's text properties marks the buffer as
  134. modified, while moving an overlay or changing its properties does not.
  135. Unlike text propery changes, overlay changes are not recorded in the
  136. buffer's undo list.
  137. `priority'
  138.      This property's value (which should be a nonnegative number)
  139.      determines the priority of the overlay.  The priority matters when
  140.      two or more overlays cover the same character and both specify a
  141.      face for display; the one whose `priority' value is larger takes
  142.      priority over the other, and its face attributes override the face
  143.      attributes of the lower priority overlay.
  144.      Currently, all overlays take priority over text properties.  Please
  145.      avoid using negative priority values, as we have not yet decided
  146.      just what they should mean.
  147. `window'
  148.      If the `window' property is non-`nil', then the overlay applies
  149.      only on that window.
  150. `category'
  151.      If an overlay has a `category' property, we call it the "category"
  152.      of the overlay.  It should be a symbol.  The properties of the
  153.      symbol serve as defaults for the properties of the overlay.
  154. `face'
  155.      This property controls the font and color of text.  Its value is a
  156.      face name or a list of face names.  *Note Faces::, for more
  157.      information.  This feature may be temporary; in the future, we may
  158.      replace it with other ways of specifying how to display text.
  159. `mouse-face'
  160.      This property is used instead of `face' when the mouse is within
  161.      the range of the overlay.  This feature may be temporary, like
  162.      `face'.
  163. `modification-hooks'
  164.      This property's value is a list of functions to be called if any
  165.      character within the overlay is changed or if text is inserted
  166.      strictly within the overlay.
  167.      The hook functions are called both before and after each change.
  168.      If the functions save the information they receive, and compare
  169.      notes between calls, they can determine exactly what change has
  170.      been made in the buffer text.
  171.      When called before a change, each function receives four
  172.      arguments: the overlay, `nil', and the beginning and end of the
  173.      text range to be modified.
  174.      When called after a change, each function receives five arguments:
  175.      the overlay, `t', the beginning and end of the text range just
  176.      modified, and the length of the pre-change text replaced by that
  177.      range.  (For an insertion, the pre-change length is zero; for a
  178.      deletion, that length is the number of characters deleted, and the
  179.      post-change beginning and end are equal.)
  180. `insert-in-front-hooks'
  181.      This property's value is a list of functions to be called before
  182.      and after inserting text right at the beginning of the overlay.
  183.      The calling conventions are the same as for the
  184.      `modification-hooks' functions.
  185. `insert-behind-hooks'
  186.      This property's value is a list of functions to be called before
  187.      and after inserting text right at the end of the overlay.  The
  188.      calling conventions are the same as for the `modification-hooks'
  189.      functions.
  190. `invisible'
  191.      The `invisible' property can make the text in the overlay
  192.      invisible, which means that it does not appear on the screen.
  193.      *Note Invisible Text::, for details.
  194. `before-string'
  195.      This property's value is a string to add to the display at the
  196.      beginning of the overlay.  The string does not appear in the
  197.      buffer in any sense--only on the screen.  The string should
  198.      contain only characters that display as a single column--control
  199.      characters, including tabs or newlines, will give strange results.
  200. `after-string'
  201.      This property's value is a string to add to the display at the end
  202.      of the overlay.  The string does not appear in the buffer in any
  203.      sense--only on the screen.  The string should contain only
  204.      characters that display as a single column--control characters,
  205.      including tabs or newlines, will give strange results.
  206. `evaporate'
  207.      If this property is non-`nil', the overlay is deleted automatically
  208.      if it ever becomes empty (i.e., if it spans no characters).
  209. `local-map'
  210.      If this property is non-`nil', it specifies a keymap for a portion
  211.      of the text.  The property's value replaces the buffer's local
  212.      map, when the character after point is within the overlay.  *Note
  213.      Active Keymaps::.
  214.    These are the functions for reading and writing the properties of an
  215. overlay.
  216.  - Function: overlay-get OVERLAY PROP
  217.      This function returns the value of property PROP recorded in
  218.      OVERLAY, if any.  If OVERLAY does not record any value for that
  219.      property, but it does have a `category' property which is a
  220.      symbol, that symbol's PROP property is used.  Otherwise, the value
  221.      is `nil'.
  222.  - Function: overlay-put OVERLAY PROP VALUE
  223.      This function sets the value of property PROP recorded in OVERLAY
  224.      to VALUE.  It returns VALUE.
  225.    See also the function `get-char-property' which checks both overlay
  226. properties and text properties for a given character.  *Note Examining
  227. Properties::.
  228. File: elisp,  Node: Managing Overlays,  Prev: Overlay Properties,  Up: Overlays
  229. Managing Overlays
  230. -----------------
  231.    This section describes the functions to create, delete and move
  232. overlays, and to examine their contents.
  233.  - Function: make-overlay START END &optional BUFFER
  234.      This function creates and returns an overlay that belongs to
  235.      BUFFER and ranges from START to END.  Both START and END must
  236.      specify buffer positions; they may be integers or markers.  If
  237.      BUFFER is omitted, the overlay is created in the current buffer.
  238.  - Function: overlay-start OVERLAY
  239.      This function returns the position at which OVERLAY starts.
  240.  - Function: overlay-end OVERLAY
  241.      This function returns the position at which OVERLAY ends.
  242.  - Function: overlay-buffer OVERLAY
  243.      This function returns the buffer that OVERLAY belongs to.
  244.  - Function: delete-overlay OVERLAY
  245.      This function deletes OVERLAY.  The overlay continues to exist as
  246.      a Lisp object, but ceases to be part of the buffer it belonged to,
  247.      and ceases to have any effect on display.
  248.  - Function: move-overlay OVERLAY START END &optional BUFFER
  249.      This function moves OVERLAY to BUFFER, and places its bounds at
  250.      START and END.  Both arguments START and END must specify buffer
  251.      positions; they may be integers or markers.  If BUFFER is omitted,
  252.      the overlay stays in the same buffer.
  253.      The return value is OVERLAY.
  254.      This is the only valid way to change the endpoints of an overlay.
  255.      Do not try modifying the markers in the overlay by hand, as that
  256.      fails to update other vital data structures and can cause some
  257.      overlays to be "lost".
  258.  - Function: overlays-at POS
  259.      This function returns a list of all the overlays that contain
  260.      position POS in the current buffer.  The list is in no particular
  261.      order.  An overlay contains position POS if it begins at or before
  262.      POS, and ends after POS.
  263.  - Function: next-overlay-change POS
  264.      This function returns the buffer position of the next beginning or
  265.      end of an overlay, after POS.
  266.  - Function: previous-overlay-change POS
  267.      This function returns the buffer position of the previous
  268.      beginning or end of an overlay, before POS.
  269. File: elisp,  Node: Faces,  Next: Blinking,  Prev: Overlays,  Up: Display
  270. Faces
  271. =====
  272.    A "face" is a named collection of graphical attributes: font,
  273. foreground color, background color and optional underlining.  Faces
  274. control the display of text on the screen.
  275.    Each face has its own "face id number" which distinguishes faces at
  276. low levels within Emacs.  However, for most purposes, you can refer to
  277. faces in Lisp programs by their names.
  278.  - Function: facep OBJECT
  279.      This function returns `t' if OBJECT is a face name symbol (or if
  280.      it is a vector of the kind used internally to record face data).
  281.      It returns `nil' otherwise.
  282.    Each face name is meaningful for all frames, and by default it has
  283. the same meaning in all frames.  But you can arrange to give a
  284. particular face name a special meaning in one frame if you wish.
  285. * Menu:
  286. * Standard Faces::      The faces Emacs normally comes with.
  287. * Merging Faces::    How Emacs decides which face to use for a character.
  288. * Face Functions::    How to define and examine faces.
  289. File: elisp,  Node: Standard Faces,  Next: Merging Faces,  Up: Faces
  290. Standard Faces
  291. --------------
  292.    This table lists all the standard faces and their uses.
  293. `default'
  294.      This face is used for ordinary text.
  295. `modeline'
  296.      This face is used for mode lines and menu bars.
  297. `region'
  298.      This face is used for highlighting the region in Transient Mark
  299.      mode.
  300. `secondary-selection'
  301.      This face is used to show any secondary selection you have made.
  302. `highlight'
  303.      This face is meant to be used for highlighting for various
  304.      purposes.
  305. `underline'
  306.      This face underlines text.
  307. `bold'
  308.      This face uses a bold font, if possible.  It uses the bold variant
  309.      of the frame's font, if it has one.  It's up to you to choose a
  310.      default font that has a bold variant, if you want to use one.
  311. `italic'
  312.      This face uses the italic variant of the frame's font, if it has
  313.      one.
  314. `bold-italic'
  315.      This face uses the bold italic variant of the frame's font, if it
  316.      has one.
  317. File: elisp,  Node: Merging Faces,  Next: Face Functions,  Prev: Standard Faces,  Up: Faces
  318. Merging Faces for Display
  319. -------------------------
  320.    Here are all the ways to specify which face to use for display of
  321. text:
  322.    * With defaults.  Each frame has a "default face", whose id number is
  323.      zero, which is used for all text that doesn't somehow specify
  324.      another face.
  325.    * With text properties.  A character may have a `face' property; if
  326.      so, it is displayed with that face.  *Note Special Properties::.
  327.      If the character has a `mouse-face' property, that is used instead
  328.      of the `face' property when the mouse is "near enough" to the
  329.      character.
  330.    * With overlays.  An overlay may have `face' and `mouse-face'
  331.      properties too; they apply to all the text covered by the overlay.
  332.    * With a region that is active.  In Transient Mark mode, the region
  333.      is highlighted with a particular face (see `region-face', below).
  334.    * With special glyphs.  Each glyph can specify a particular face id
  335.      number.  *Note Glyphs::.
  336.    If these various sources together specify more than one face for a
  337. particular character, Emacs merges the attributes of the various faces
  338. specified.  The attributes of the faces of special glyphs come first;
  339. then comes the face for region highlighting, if appropriate; then come
  340. attributes of faces from overlays, followed by those from text
  341. properties, and last the default face.
  342.    When multiple overlays cover one character, an overlay with higher
  343. priority overrides those with lower priority.  *Note Overlays::.
  344.    If an attribute such as the font or a color is not specified in any
  345. of the above ways, the frame's own font or color is used.
  346. File: elisp,  Node: Face Functions,  Prev: Merging Faces,  Up: Faces
  347. Functions for Working with Faces
  348. --------------------------------
  349.    The attributes a face can specify include the font, the foreground
  350. color, the background color, and underlining.  The face can also leave
  351. these unspecified by giving the value `nil' for them.
  352.    Here are the primitives for creating and changing faces.
  353.  - Function: make-face NAME
  354.      This function defines a new face named NAME, initially with all
  355.      attributes `nil'.  It does nothing if there is already a face named
  356.      NAME.
  357.  - Function: face-list
  358.      This function returns a list of all defined face names.
  359.  - Function: copy-face OLD-FACE NEW-NAME &optional FRAME NEW-FRAME
  360.      This function defines the face NEW-NAME as a copy of the existing
  361.      face named OLD-FACE.  It creates the face NEW-NAME if that doesn't
  362.      already exist.
  363.      If the optional argument FRAME is given, this function applies
  364.      only to that frame.  Otherwise it applies to each frame
  365.      individually, copying attributes from OLD-FACE in each frame to
  366.      NEW-FACE in the same frame.
  367.      If the optional argument NEW-FRAME is given, then `copy-face'
  368.      copies the attributes of OLD-FACE in FRAME to NEW-NAME in
  369.      NEW-FRAME.
  370.    You can modify the attributes of an existing face with the following
  371. functions.  If you specify FRAME, they affect just that frame;
  372. otherwise, they affect all frames as well as the defaults that apply to
  373. new frames.
  374.  - Function: set-face-foreground FACE COLOR &optional FRAME
  375.  - Function: set-face-background FACE COLOR &optional FRAME
  376.      These functions set the foreground (or background, respectively)
  377.      color of face FACE to COLOR.  The argument COLOR should be a
  378.      string, the name of a color.
  379.      Certain shades of gray are implemented by stipple patterns on
  380.      black-and-white screens.
  381.  - Function: set-face-stipple FACE PATTERN &optional FRAME
  382.      This function sets the background stipple pattern of face FACE to
  383.      PATTERN.  The argument PATTERN should be the name of a stipple
  384.      pattern defined by the X server, or `nil' meaning don't use
  385.      stipple.
  386.      Normally there is no need to pay attention to stipple patterns,
  387.      because they are used automatically to handle certain shades of
  388.      gray.
  389.  - Function: set-face-font FACE FONT &optional FRAME
  390.      This function sets the font of face FACE.  The argument FONT
  391.      should be a string.
  392.  - Function: set-face-underline-p FACE UNDERLINE-P &optional FRAME
  393.      This function sets the underline attribute of face FACE.
  394.      Non-`nil' means do underline; `nil' means don't.
  395.  - Function: invert-face FACE &optional FRAME
  396.      Swap the foreground and background colors of face FACE.  If the
  397.      face doesn't specify both foreground and background, then its
  398.      foreground and background are set to the default background and
  399.      foreground, respectively.
  400.    These functions examine the attributes of a face.  If you don't
  401. specify FRAME, they refer to the default data for new frames.
  402.  - Function: face-foreground FACE &optional FRAME
  403.  - Function: face-background FACE &optional FRAME
  404.      These functions return the foreground color (or background color,
  405.      respectively) of face FACE, as a string.
  406.  - Function: face-stipple FACE &optional FRAME
  407.      This function returns the name of the background stipple pattern
  408.      of face FACE, or `nil' if it doesn't have one.
  409.  - Function: face-font FACE &optional FRAME
  410.      This function returns the name of the font of face FACE.
  411.  - Function: face-underline-p FACE &optional FRAME
  412.      This function returns the underline attribute of face FACE.
  413.  - Function: face-id FACE
  414.      This function returns the face id number of face FACE.
  415.  - Function: face-equal FACE1 FACE2 &optional FRAME
  416.      This returns `t' if the faces FACE1 and FACE2 have the same
  417.      attributes for display.
  418.  - Function: face-differs-from-default-p FACE &optional FRAME
  419.      This returns `t' if the face FACE displays differently from the
  420.      default face.  A face is considered to be "the same" as the normal
  421.      face if each attribute is either the same as that of the default
  422.      face or `nil' (meaning to inherit from the default).
  423.  - Variable: region-face
  424.      This variable's value specifies the face id to use to display
  425.      characters in the region when it is active (in Transient Mark mode
  426.      only).  The face thus specified takes precedence over all faces
  427.      that come from text properties and overlays, for characters in the
  428.      region.  *Note The Mark::, for more information about Transient
  429.      Mark mode.
  430.      Normally, the value is the id number of the face named `region'.
  431. File: elisp,  Node: Blinking,  Next: Inverse Video,  Prev: Faces,  Up: Display
  432. Blinking Parentheses
  433. ====================
  434.    This section describes the mechanism by which Emacs shows a matching
  435. open parenthesis when the user inserts a close parenthesis.
  436.  - Variable: blink-paren-function
  437.      The value of this variable should be a function (of no arguments)
  438.      to be called whenever a character with close parenthesis syntax is
  439.      inserted.  The value of `blink-paren-function' may be `nil', in
  440.      which case nothing is done.
  441.           *Please note:* This variable was named `blink-paren-hook' in
  442.           older Emacs versions, but since it is not called with the
  443.           standard convention for hooks, it was renamed to
  444.           `blink-paren-function' in version 19.
  445.  - Variable: blink-matching-paren
  446.      If this variable is `nil', then `blink-matching-open' does nothing.
  447.  - Variable: blink-matching-paren-distance
  448.      This variable specifies the maximum distance to scan for a matching
  449.      parenthesis before giving up.
  450.  - Variable: blink-matching-paren-delay
  451.      This variable specifies the number of seconds for the cursor to
  452.      remain at the matching parenthesis.  A fraction of a second often
  453.      gives good results, but the default is 1, which works on all
  454.      systems.
  455.  - Function: blink-matching-open
  456.      This function is the default value of `blink-paren-function'.  It
  457.      assumes that point follows a character with close parenthesis
  458.      syntax and moves the cursor momentarily to the matching opening
  459.      character.  If that character is not already on the screen, it
  460.      displays the character's context in the echo area.  To avoid long
  461.      delays, this function does not search farther than
  462.      `blink-matching-paren-distance' characters.
  463.      Here is an example of calling this function explicitly.
  464.           (defun interactive-blink-matching-open ()
  465.             "Indicate momentarily the start of sexp before point."
  466.             (interactive)
  467.           (let ((blink-matching-paren-distance
  468.                    (buffer-size))
  469.                   (blink-matching-paren t))
  470.               (blink-matching-open)))
  471. File: elisp,  Node: Inverse Video,  Next: Usual Display,  Prev: Blinking,  Up: Display
  472. Inverse Video
  473. =============
  474.  - User Option: inverse-video
  475.      This variable controls whether Emacs uses inverse video for all
  476.      text on the screen.  Non-`nil' means yes, `nil' means no.  The
  477.      default is `nil'.
  478.  - User Option: mode-line-inverse-video
  479.      This variable controls the use of inverse video for mode lines.
  480.      If it is non-`nil', then mode lines are displayed in inverse video.
  481.      Otherwise, mode lines are displayed normally, just like text.  The
  482.      default is `t'.
  483.      For X window frames, this displays mode lines using the face named
  484.      `modeline', which is normally the inverse of the default face
  485.      unless you change it.
  486. File: elisp,  Node: Usual Display,  Next: Display Tables,  Prev: Inverse Video,  Up: Display
  487. Usual Display Conventions
  488. =========================
  489.    The usual display conventions define how to display each character
  490. code.  You can override these conventions by setting up a display table
  491. (*note Display Tables::.).  Here are the usual display conventions:
  492.    * Character codes 32 through 126 map to glyph codes 32 through 126.
  493.      Normally this means they display as themselves.
  494.    * Character code 9 is a horizontal tab.  It displays as whitespace
  495.      up to a position determined by `tab-width'.
  496.    * Character code 10 is a newline.
  497.    * All other codes in the range 0 through 31, and code 127, display
  498.      in one of two ways according to the value of `ctl-arrow'.  If it is
  499.      non-`nil', these codes map to sequences of two glyphs, where the
  500.      first glyph is the ASCII code for `^'.  (A display table can
  501.      specify a glyph to use instead of `^'.)  Otherwise, these codes map
  502.      just like the codes in the range 128 to 255.
  503.    * Character codes 128 through 255 map to sequences of four glyphs,
  504.      where the first glyph is the ASCII code for `\', and the others are
  505.      digit characters representing the code in octal.  (A display table
  506.      can specify a glyph to use instead of `\'.)
  507.    The usual display conventions apply even when there is a display
  508. table, for any character whose entry in the active display table is
  509. `nil'.  Thus, when you set up a display table, you need only specify
  510. the characters for which you want unusual behavior.
  511.    These variables affect the way certain characters are displayed on
  512. the screen.  Since they change the number of columns the characters
  513. occupy, they also affect the indentation functions.
  514.  - User Option: ctl-arrow
  515.      This buffer-local variable controls how control characters are
  516.      displayed.  If it is non-`nil', they are displayed as a caret
  517.      followed by the character: `^A'.  If it is `nil', they are
  518.      displayed as a backslash followed by three octal digits: `\001'.
  519.  - Variable: default-ctl-arrow
  520.      The value of this variable is the default value for `ctl-arrow' in
  521.      buffers that do not override it.  *Note Default Value::.
  522.  - User Option: tab-width
  523.      The value of this variable is the spacing between tab stops used
  524.      for displaying tab characters in Emacs buffers.  The default is 8.
  525.      Note that this feature is completely independent from the
  526.      user-settable tab stops used by the command `tab-to-tab-stop'.
  527.      *Note Indent Tabs::.
  528. File: elisp,  Node: Display Tables,  Next: Beeping,  Prev: Usual Display,  Up: Display
  529. Display Tables
  530. ==============
  531.    You can use the "display table" feature to control how all 256
  532. possible character codes display on the screen.  This is useful for
  533. displaying European languages that have letters not in the ASCII
  534. character set.
  535.    The display table maps each character code into a sequence of
  536. "glyphs", each glyph being an image that takes up one character
  537. position on the screen.  You can also define how to display each glyph
  538. on your terminal, using the "glyph table".
  539. * Menu:
  540. * Display Table Format::    What a display table consists of.
  541. * Active Display Table::    How Emacs selects a display table to use.
  542. * Glyphs::            How to define a glyph, and what glyphs mean.
  543. * ISO Latin 1::            How to use display tables
  544.                   to support the ISO Latin 1 character set.
  545. File: elisp,  Node: Display Table Format,  Next: Active Display Table,  Up: Display Tables
  546. Display Table Format
  547. --------------------
  548.    A display table is actually an array of 262 elements.
  549.  - Function: make-display-table
  550.      This creates and returns a display table.  The table initially has
  551.      `nil' in all elements.
  552.    The first 256 elements correspond to character codes; the Nth
  553. element says how to display the character code N.  The value should be
  554. `nil' or a vector of glyph values (*note Glyphs::.).  If an element is
  555. `nil', it says to display that character according to the usual display
  556. conventions (*note Usual Display::.).
  557.    If you use the display table to change the display of newline
  558. characters, the whole buffer will be displayed as one long "line."
  559.    The remaining six elements of a display table serve special purposes,
  560. and `nil' means use the default stated below.
  561.      The glyph for the end of a truncated screen line (the default for
  562.      this is `$').  *Note Glyphs::.
  563.      The glyph for the end of a continued line (the default is `\').
  564.      The glyph for indicating a character displayed as an octal
  565.      character code (the default is `\').
  566.      The glyph for indicating a control character (the default is `^').
  567.      A vector of glyphs for indicating the presence of invisible lines
  568.      (the default is `...').  *Note Selective Display::.
  569.      The glyph used to draw the border between side-by-side windows (the
  570.      default is `|').  *Note Splitting Windows::.
  571.    For example, here is how to construct a display table that mimics the
  572. effect of setting `ctl-arrow' to a non-`nil' value:
  573.      (setq disptab (make-display-table))
  574.      (let ((i 0))
  575.        (while (< i 32)
  576.          (or (= i ?\t) (= i ?\n)
  577.              (aset disptab i (vector ?^ (+ i 64))))
  578.          (setq i (1+ i)))
  579.        (aset disptab 127 (vector ?^ ??)))
  580. File: elisp,  Node: Active Display Table,  Next: Glyphs,  Prev: Display Table Format,  Up: Display Tables
  581. Active Display Table
  582. --------------------
  583.    Each window can specify a display table, and so can each buffer.
  584. When a buffer B is displayed in window W, display uses the display
  585. table for window W if it has one; otherwise, the display table for
  586. buffer B if it has one; otherwise, the standard display table if any.
  587. The display table chosen is called the "active" display table.
  588.  - Function: window-display-table WINDOW
  589.      This function returns WINDOW's display table, or `nil' if WINDOW
  590.      does not have an assigned display table.
  591.  - Function: set-window-display-table WINDOW TABLE
  592.      This function sets the display table of WINDOW to TABLE.  The
  593.      argument TABLE should be either a display table or `nil'.
  594.  - Variable: buffer-display-table
  595.      This variable is automatically local in all buffers; its value in a
  596.      particular buffer is the display table for that buffer, or `nil' if
  597.      the buffer does not have an assigned display table.
  598.  - Variable: standard-display-table
  599.      This variable's value is the default display table, used whenever a
  600.      window has no display table and neither does the buffer displayed
  601.      in that window.  This variable is `nil' by default.
  602.    If there is no display table to use for a particular window--that is,
  603. if the window has none, its buffer has none, and
  604. `standard-display-table' has none--then Emacs uses the usual display
  605. conventions for all character codes in that window.  *Note Usual
  606. Display::.
  607. File: elisp,  Node: Glyphs,  Next: ISO Latin 1,  Prev: Active Display Table,  Up: Display Tables
  608. Glyphs
  609. ------
  610.    A "glyph" is a generalization of a character; it stands for an image
  611. that takes up a single character position on the screen.  Glyphs are
  612. represented in Lisp as integers, just as characters are.
  613.    The meaning of each integer, as a glyph, is defined by the glyph
  614. table, which is the value of the variable `glyph-table'.
  615.  - Variable: glyph-table
  616.      The value of this variable is the current glyph table.  It should
  617.      be a vector; the Gth element defines glyph code G.  If the value
  618.      is `nil' instead of a vector, then all glyphs are simple (see
  619.      below).
  620.    Here are the possible types of elements in the glyph table:
  621. STRING
  622.      Send the characters in STRING to the terminal to output this
  623.      glyph.  This alternative is available on character terminals, but
  624.      not under X.
  625. INTEGER
  626.      Define this glyph code as an alias for code INTEGER.  You can use
  627.      an alias to specify a face code for the glyph; see below.
  628. `NIL'
  629.      This glyph is simple.  On an ordinary terminal, the glyph code mod
  630.      256 is the character to output.  With X, the glyph code mod 256 is
  631.      the character to output, and the glyph code divided by 256
  632.      specifies the "face id number" to use while outputting it.  *Note
  633.      Faces::.
  634.    If a glyph code is greater than or equal to the length of the glyph
  635. table, that code is automatically simple.
  636. File: elisp,  Node: ISO Latin 1,  Prev: Glyphs,  Up: Display Tables
  637. ISO Latin 1
  638. -----------
  639.    If you have a terminal that can handle the entire ISO Latin 1
  640. character set, you can arrange to use that character set as follows:
  641.      (require 'disp-table)
  642.      ;; Set char codes 160--255 to display as themselves.
  643.      ;; (Codes 128--159 are the additional control characters.)
  644.      (standard-display-8bit 160 255)
  645.    If you are editing buffers written in the ISO Latin 1 character set
  646. and your terminal doesn't handle anything but ASCII, you can load the
  647. file `iso-ascii' to set up a display table that displays the other ISO
  648. characters as explanatory sequences of ASCII characters.  For example,
  649. the character "o with umlaut" displays as `{"o}'.
  650.    Some European countries have terminals that don't support ISO Latin 1
  651. but do support the special characters for that country's language.  You
  652. can define a display table to work one language using such terminals.
  653. For an example, see `lisp/iso-swed.el', which handles certain Swedish
  654. terminals.
  655.    You can load the appropriate display table for your terminal
  656. automatically by writing a terminal-specific Lisp file for the terminal
  657. type.
  658. File: elisp,  Node: Beeping,  Next: Window Systems,  Prev: Display Tables,  Up: Display
  659. Beeping
  660. =======
  661.    You can make Emacs ring a bell (or blink the screen) to attract the
  662. user's attention.  Be conservative about how often you do this; frequent
  663. bells can become irritating.  Also be careful not to use beeping alone
  664. when signaling an error is appropriate.  (*Note Errors::.)
  665.  - Function: ding &optional DONT-TERMINATE
  666.      This function beeps, or flashes the screen (see `visible-bell'
  667.      below).  It also terminates any keyboard macro currently executing
  668.      unless DONT-TERMINATE is non-`nil'.
  669.  - Function: beep &optional DONT-TERMINATE
  670.      This is a synonym for `ding'.
  671.  - Variable: visible-bell
  672.      This variable determines whether Emacs should flash the screen to
  673.      represent a bell.  Non-`nil' means yes, `nil' means no.  This is
  674.      effective under X windows, and on a character-only terminal
  675.      provided the terminal's Termcap entry defines the visible bell
  676.      capability (`vb').
  677. File: elisp,  Node: Window Systems,  Prev: Beeping,  Up: Display
  678. Window Systems
  679. ==============
  680.    Emacs works with several window systems, most notably the X Window
  681. System.  Both Emacs and X use the term "window", but use it
  682. differently.  An Emacs frame is a single window as far as X is
  683. concerned; the individual Emacs windows are not known to X at all.
  684.  - Variable: window-system
  685.      This variable tells Lisp programs what window system Emacs is
  686.      running under.  Its value should be a symbol such as `x' (if Emacs
  687.      is running under X) or `nil' (if Emacs is running on an ordinary
  688.      terminal).
  689.  - Variable: window-setup-hook
  690.      This variable is a normal hook which Emacs runs after loading your
  691.      `.emacs' file and the default initialization file (if any), after
  692.      loading terminal-specific Lisp code, and after running the hook
  693.      `term-setup-hook'.
  694.      This hook is used for internal purposes: setting up communication
  695.      with the window system, and creating the initial window.  Users
  696.      should not interfere with it.
  697. File: elisp,  Node: Calendar,  Next: Tips,  Prev: Display,  Up: Top
  698. Customizing the Calendar and Diary
  699. **********************************
  700.    There are many customizations that you can use to make the calendar
  701. and diary suit your personal tastes.
  702. * Menu:
  703. * Calendar Customizing::   Defaults you can set.
  704. * Holiday Customizing::    Defining your own holidays.
  705. * Date Display Format::    Changing the format.
  706. * Time Display Format::    Changing the format.
  707. * Daylight Savings::       Changing the default.
  708. * Diary Customizing::      Defaults you can set.
  709. * Hebrew/Islamic Entries:: How to obtain them.
  710. * Fancy Diary Display::    Enhancing the diary display, sorting entries,
  711.                              using included diary files.
  712. * Sexp Diary Entries::     Fancy things you can do.
  713. * Appt Customizing::       Customizing appointment reminders.
  714. File: elisp,  Node: Calendar Customizing,  Next: Holiday Customizing,  Up: Calendar
  715. Customizing the Calendar
  716. ========================
  717.    If you set the variable `view-diary-entries-initially' to `t',
  718. calling up the calendar automatically displays the diary entries for
  719. the current date as well.  The diary dates appear only if the current
  720. date is visible.  If you add both of the following lines to your
  721. `.emacs' file:
  722.      (setq view-diary-entries-initially t)
  723.      (calendar)
  724. this displays both the calendar and diary windows whenever you start
  725. Emacs.
  726.    Similarly, if you set the variable
  727. `view-calendar-holidays-initially' to `t', entering the calendar
  728. automatically displays a list of holidays for the current three-month
  729. period.  The holiday list appears in a separate window.
  730.    You can set the variable `mark-diary-entries-in-calendar' to `t' in
  731. order to mark any dates with diary entries.  This takes effect whenever
  732. the calendar window contents are recomputed.  There are two ways of
  733. marking these dates: by changing the face (*note Faces::.), if the
  734. display supports that, or by placing a plus sign (`+') beside the date
  735. otherwise.
  736.    Similarly, setting the variable `mark-holidays-in-calendar' to `t'
  737. marks holiday dates, either with a change of face or with an asterisk
  738. (`*').
  739.    The variable `calendar-holiday-marker' specifies how to mark a date
  740. as being a holiday.  Its value may be a character to insert next to the
  741. date, or a face name to use for displaying the date.  Likewise, the
  742. variable `diary-entry-marker' specifies how to mark a date that has
  743. diary entries.  The calendar creates faces named `holiday-face' and
  744. `diary-face' for these purposes; those symbols are the default values
  745. of these variables, when Emacs supports multiple faces on your terminal.
  746.    The variable `calendar-load-hook' is a normal hook run when the
  747. calendar package is first loaded (before actually starting to display
  748. the calendar).
  749.    Starting the calendar runs the normal hook
  750. `initial-calendar-window-hook'.  Recomputation of the calendar display
  751. does not run this hook.  But if you leave the calendar with the `q'
  752. command and reenter it, the hook runs again.
  753.    The variable `today-visible-calendar-hook' is a normal hook run
  754. after the calendar buffer has been prepared with the calendar when the
  755. current date is visible in the window.  One use of this hook is to
  756. replace today's date with asterisks; to do that, use the hook function
  757. `calendar-star-date'.
  758.      (add-hook 'today-visible-calendar-hook 'calendar-star-date)
  759. Another standard hook function marks the current date, either by
  760. changing its face or by adding an asterisk.  Here's how to use it:
  761.      (add-hook 'today-visible-calendar-hook 'calendar-mark-today)
  762. The variable `calendar-today-marker' specifies how to mark today's
  763. date.  Its value should be a character to insert next to the date or a
  764. face name to use for displaying the date.  A face named
  765. `calendar-today-face' is provided for this purpose; that symbol is the
  766. default for this variable when Emacs supports multiple faces on your
  767. terminal.
  768. A similar normal hook, `today-invisible-calendar-hook' is run if the
  769. current date is *not* visible in the window.
  770. File: elisp,  Node: Holiday Customizing,  Next: Date Display Format,  Prev: Calendar Customizing,  Up: Calendar
  771. Customizing the Holidays
  772. ========================
  773.    Emacs knows about holidays defined by entries on one of several
  774. lists.  You can customize these lists of holidays to your own needs,
  775. adding or deleting holidays.  The lists of holidays that Emacs uses are
  776. for general holidays (`general-holidays'), local holidays
  777. (`local-holidays'), Christian holidays (`christian-holidays'), Hebrew
  778. (Jewish) holidays (`hebrew-holidays'), Islamic (Moslem) holidays
  779. (`islamic-holidays'), and other holidays (`other-holidays').
  780.    The general holidays are, by default, holidays common throughout the
  781. United States.  To eliminate these holidays, set `general-holidays' to
  782. `nil'.
  783.    There are no default local holidays (but sites may supply some).  You
  784. can set the variable `local-holidays' to any list of holidays, as
  785. described below.
  786.    By default, Emacs does not include all the holidays of the religions
  787. that it knows, only those commonly found in secular calendars.  For a
  788. more extensive collection of religious holidays, you can set any (or
  789. all) of the variables `all-christian-calendar-holidays',
  790. `all-hebrew-calendar-holidays', or `all-islamic-calendar-holidays' to
  791. `t'.  If you want to eliminate the religious holidays, set any or all
  792. of the corresponding variables `christian-holidays', `hebrew-holidays',
  793. and `islamic-holidays' to `nil'.
  794.    You can set the variable `other-holidays' to any list of holidays.
  795. This list, normally empty, is intended for individual use.
  796.    Each of the lists (`general-holidays', `local-holidays',
  797. `christian-holidays', `hebrew-holidays', `islamic-holidays', and
  798. `other-holidays') is a list of "holiday forms", each holiday form
  799. describing a holiday (or sometimes a list of holidays).
  800.    Here is a table of the possible kinds of holiday form.  Day numbers
  801. and month numbers count starting from 1, but "dayname" numbers count
  802. Sunday as 0.  The element STRING is always the name of the holiday, as
  803. a string.
  804. `(holiday-fixed MONTH DAY STRING)'
  805.      A fixed date on the Gregorian calendar.
  806. `(holiday-float MONTH DAYNAME K STRING)'
  807.      The Kth DAYNAME in MONTH on the Gregorian calendar (DAYNAME=0 for
  808.      Sunday, and so on); negative K means count back from the end of
  809.      the month.
  810. `(holiday-hebrew MONTH DAY STRING)'
  811.      A fixed date on the Hebrew calendar.
  812. `(holiday-islamic MONTH DAY STRING)'
  813.      A fixed date on the Islamic calendar.
  814. `(holiday-julian MONTH DAY STRING)'
  815.      A fixed date on the Julian calendar.
  816. `(holiday-sexp SEXP STRING)'
  817.      A date calculated by the Lisp expression SEXP.  The expression
  818.      should use the variable `year' to compute and return the date of a
  819.      holiday, or `nil' if the holiday doesn't happen this year.  The
  820.      value of SEXP must represent the date as a list of the form
  821.      `(MONTH DAY YEAR)'.
  822. `(if CONDITION HOLIDAY-FORM)'
  823.      A holiday that happens only if CONDITION is true.
  824. `(FUNCTION [ARGS])'
  825.      A list of dates calculated by the function FUNCTION, called with
  826.      arguments ARGS.
  827.    For example, suppose you want to add Bastille Day, celebrated in
  828. France on July 14.  You can do this as follows:
  829.      (setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
  830. The holiday form `(holiday-fixed 7 14 "Bastille Day")' specifies the
  831. fourteenth day of the seventh month (July).
  832.    Many holidays occur on a specific day of the week, at a specific time
  833. of month.  Here is a holiday form describing Hurricane Supplication Day,
  834. celebrated in the Virgin Islands on the fourth Monday in August:
  835.      (holiday-float 8 1 4 "Hurricane Supplication Day")
  836. Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
  837. Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
  838. the month (1 specifies the first occurrence, 2 the second occurrence,
  839. -1 the last occurrence, -2 the second-to-last occurrence, and so on).
  840.    You can specify holidays that occur on fixed days of the Hebrew,
  841. Islamic, and Julian calendars too.  For example,
  842.      (setq other-holidays
  843.            '((holiday-hebrew 10 2 "Last day of Hanukkah")
  844.              (holiday-islamic 3 12 "Mohammed's Birthday")
  845.              (holiday-julian 4 2 "Jefferson's Birthday")))
  846. adds the last day of Hanukkah (since the Hebrew months are numbered with
  847. 1 starting from Nisan), the Islamic feast celebrating Mohammed's
  848. birthday (since the Islamic months are numbered from 1 starting with
  849. Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the
  850. Julian calendar.
  851.    To include a holiday conditionally, use either Emacs Lisp's `if' or
  852. the `holiday-sexp' form.  For example, American presidential elections
  853. occur on the first Tuesday after the first Monday in November of years
  854. divisible by 4:
  855.      (holiday-sexp (if (= 0 (% year 4))
  856.                         (calendar-gregorian-from-absolute
  857.                          (1+ (calendar-dayname-on-or-before
  858.                                1 (+ 6 (calendar-absolute-from-gregorian
  859.                                        (list 11 1 year))))))
  860.                    "US Presidential Election"))
  861.      (if (= 0 (% displayed-year 4))
  862.          (fixed 11
  863.                 (extract-calendar-day
  864.                   (calendar-gregorian-from-absolute
  865.                     (1+ (calendar-dayname-on-or-before
  866.                           1 (+ 6 (calendar-absolute-from-gregorian
  867.                                    (list 11 1 displayed-year)))))))
  868.                 "US Presidential Election"))
  869.    Some holidays just don't fit into any of these forms because special
  870. calculations are involved in their determination.  In such cases you
  871. must write a Lisp function to do the calculation.  To include eclipses,
  872. for example, add `(eclipses)' to `other-holidays' and write an Emacs
  873. Lisp function `eclipses' that returns a (possibly empty) list of the
  874. relevant Gregorian dates among the range visible in the calendar
  875. window, with descriptive strings, like this:
  876.      (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
  877. File: elisp,  Node: Date Display Format,  Next: Time Display Format,  Prev: Holiday Customizing,  Up: Calendar
  878. Date Display Format
  879. ===================
  880.    You can customize the manner of displaying dates in the diary, in
  881. mode lines, and in messages by setting `calendar-date-display-form'.
  882. This variable holds a list of expressions that can involve the variables
  883. `month', `day', and `year', which are all numbers in string form, and
  884. `monthname' and `dayname', which are both alphabetic strings.  In the
  885. American style, the default value of this list is as follows:
  886.      ((if dayname (concat dayname ", ")) monthname " " day ", " year)
  887. while in the European style this value is the default:
  888.      ((if dayname (concat dayname ", ")) day " " monthname " " year)
  889. The ISO standard date representation is this:
  890.      (year "-" month "-" day)
  891. This specifies a typical American format:
  892.      (month "/" day "/" (substring year -2))
  893. File: elisp,  Node: Time Display Format,  Next: Daylight Savings,  Prev: Date Display Format,  Up: Calendar
  894. Time Display Format
  895. ===================
  896.    The calendar and diary by default display times of day in the
  897. conventional American style with the hours from 1 through 12, minutes,
  898. and either `am' or `pm'.  If you prefer the European style, also known
  899. in the US as military, in which the hours go from 00 to 23, you can
  900. alter the variable `calendar-time-display-form'.  This variable is a
  901. list of expressions that can involve the variables `12-hours',
  902. `24-hours', and `minutes', which are all numbers in string form, and
  903. `am-pm' and `time-zone', which are both alphabetic strings.  The
  904. default value of `calendar-time-display-form' is as follows:
  905.      (12-hours ":" minutes am-pm
  906.                (if time-zone " (") time-zone (if time-zone ")"))
  907. Here is a value that provides European style times:
  908.      (24-hours ":" minutes
  909.                (if time-zone " (") time-zone (if time-zone ")"))
  910.